<template>
  <div>
    <van-nav-bar
      :title="'讨论组'"
      left-arrow
      @click-left="$router.back()"
      @click-right="goDetail"
    >
      <i slot="right" class="fs-18 icon-peoples iconfont"></i>
    </van-nav-bar>
    <div></div>
  <van-cell title="群成员" value="内容" />
    <div class="list">
      <div class="user-item" v-for="item in users" :key="item.id">
        <img class="avatar" width="40" height="40" :src="item.avatar" alt="" />
        <div class="nickname fs-14">{{ item.nickname }}</div>
      </div>
    </div>
  </div>
</template>

<script>
import napi from '@/api/napi'
export default {
  data() {
    return {
      users: []
    }
  },
  mounted() {
    napi.getRoomUserList({ roomId: this.$route.params.roomId }).then(res => {
      this.users = res
    })
  },
  methods: {
    goDetail() {
      this.$router.push({
        name: 'room-detail',
        params: this.$route.params
      })
    }
  }
}
</script>

<style lang="less" scoped>
.list {
  background-color: #fff;
}
.user-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 25%;
  color: gray;
  .avatar {
    margin-top: 10px;
    border-radius: 4px;
  }
  .nickname {
    margin-top: 10px;
    font-size: 13px;
  }
}
</style>
